import DEntity from "./DEntity";
import { EntityPools } from "./EntityPools";

const { ccclass, property } = cc._decorator;

/**
 * 可挂载的部分，方便快速处理一个实体数据
 * 组件和实体共享同一个生命周期
 */
@ccclass
export default class UEntity extends cc.Component {

    public _entity: DEntity

    onLoad() {
        this._entity = EntityPools.ins().createEntity()
        console.log(this._entity.id)
    }
    start() {

    }
    update() {

    }
    onDestroy() {
        EntityPools.ins().collectionEntity(this._entity)
        this._entity = null;
    }
}
